import wyrequest from '@/utils/wyrequest'

export interface categoryL2List {
  frontDesc: null
  frontName:string
  frontNameIcon: null
  iconUrl: null
  id: number
  imgUrl: null
  level: null
  name: "换季清仓"
  showIndex: number
  subCateList: []
  superCategoryId: number
  type: number
  wapBannerUrl: undefined | string
  wapExpandPicTargetUrl: null
}
export interface categoryL1List {
  id: number,
  superCategoryId: number,
  showIndex: number,
  name: string,
  frontName: null,
  frontNameIcon: null,
  frontDesc: null,
  bannerUrl: undefined | string,
  bannerList: null,
  iconUrl: null | string,
  imgUrl: null,
  level: null | string,
  subCateList: [],
  wapBannerUrl: null | string,
  type: number,
  wapExpandPicTargetUrl: null,
  categoryType: number,
  extra: null
  categoryId:number
}
export interface categoryGroupList{
  categoryList:[],
  id:number,
  name:string
}
export interface dataList {
  categoryGroupList:categoryGroupList [],
  categoryL1List: categoryL1List[],
  categoryL2List: categoryL2List[],
  currentCategory: []
}

export interface TabbarDataModel {
  categoryL1List: any
  [x: string]: any
  data: dataList,
  YXJSONArray: Object,
  YXJSONObject: Object,
  global: Object
}

export default {
  getTabbarData() {
    return wyrequest.get<any, TabbarDataModel>(`/item/cateList.json?__timestamp=1630131286110&categoryId=`)
  },
  getRightList(categoryId: number) {
    return wyrequest.get<any,TabbarDataModel>(`/item/cateList.json?__timestamp=1630131455012&categoryId=${categoryId}`)
  }
}